gtk_header_bar_compute_size_for_opposing_orientation (widget, width, minimum_height, natural_height);
}
+static gboolean
+close_button_at_end (GtkWidget *widget)
+{
+ gchar *layout_desc;
+ gboolean at_end;
+ gchar *p;
+
+ gtk_widget_style_get (gtk_widget_get_toplevel (widget),
+ "decoration-button-layout", &layout_desc, NULL);
+
+ p = strchr (layout_desc, ':');
+ if (p && strstr (p, "close"))
+ at_end = TRUE;
+ else
+ at_end = FALSE;
+
+ g_free (layout_desc);
+
+ return at_end;
+}
+
static void
gtk_header_bar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
gint child_size;
GtkTextDirection direction;
GtkBorder css_borders;
+ gboolean at_end;
+
+ at_end = close_button_at_end (widget);
gtk_widget_set_allocation (widget, allocation);
child_allocation.y = allocation->y + css_borders.top;
child_allocation.height = height;
if (packing == GTK_PACK_START)
- x = allocation->x + css_borders.left;
+ x = allocation->x + css_borders.left + (at_end ? 0 : close_width);
else
- x = allocation->x + allocation->width - close_width - css_borders.right;
+ x = allocation->x + allocation->width - (at_end ? close_width : 0) - css_borders.right;
if (packing == GTK_PACK_START)
{
}
}
- side[GTK_PACK_END] += close_width;
+ if (at_end)
+ side[GTK_PACK_END] += close_width;
+ else
+ side[GTK_PACK_START] += close_width;
child_allocation.y = allocation->y + css_borders.top;
child_allocation.height = height;
if (priv->close_button)
{
+ gboolean left;
+
if (direction == GTK_TEXT_DIR_RTL)
+ left = at_end;
+ else
+ left = !at_end;
+
+ if (left)
child_allocation.x = allocation->x + css_borders.left;
else
child_allocation.x = allocation->x + allocation->width - css_borders.right - close_button_width;
child_allocation.width = close_button_width;
gtk_widget_size_allocate (priv->close_button, &child_allocation);
- if (direction == GTK_TEXT_DIR_RTL)
+ if (left)
child_allocation.x = allocation->x + css_borders.left + close_button_width + priv->spacing;
else
child_allocation.x = allocation->x + allocation->width - css_borders.right - close_button_width - priv->spacing - separator_width;